package tech.aichan.AiQA.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import tech.aichan.AiQA.model.dto.user.UserUpdateRequest;
import tech.aichan.AiQA.model.entity.User;

import tech.aichan.AiQA.model.vo.LoginUserVO;

import jakarta.servlet.http.HttpServletRequest;
import org.springframework.transaction.annotation.Transactional;

public interface UserService extends IService<User> {

    /**
     * 用户注册
     *
     * @param userAccount   用户账户
     * @param userPassword  用户密码
     * @param checkPassword 校验密码
     * @return 新用户 id
     */
    long userRegister(String userAccount, String userPassword, String checkPassword, String email, Integer code);

    /**
     * 用户登录
     *
     * @param userAccount  用户账户
     * @param userPassword 用户密码
     * @return 脱敏后的用户信息
     */
    LoginUserVO userLogin(String userAccount, String userPassword);

    /**
     * 获取当前登录用户
     *
     * @param request
     * @return
     */
    User getLoginUser(HttpServletRequest request);

    Long userForgetPassword(String email, String password, String checkPassword, Integer code);

    @Transactional
    void logout();

    /**
     * 获取当前登录用户
     * @return
     */
    LoginUserVO getLoginUserVO(String token);

    User addUser(String userAccount, String password, String email, String role);

    void updateUser(UserUpdateRequest userUpdateRequest);

    void deleteUser(Long id);

    Page<User> listUserByPage(Long id, String userName, String userRole, long current, long size);
}
